package wzj.com.atguigu.lease.web.app.controller.payment;


import com.atguigu.lease.common.result.Result;
import com.atguigu.lease.model.entity.PaymentType;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import wzj.com.atguigu.lease.web.app.service.PaymentTypeService;

import java.util.List;


    @Tag(name = "支付方式接口")
    @RestController
    @RequestMapping("/app/payment")
    public class PaymentTypeController {

        @Autowired
        private PaymentTypeService service;

        @Operation(summary = "获取全部支付方式列表")
        @GetMapping("list")
        public Result<List<PaymentType>> list() {
            List<PaymentType> list = service.list();
            return Result.ok(list);
        }
        @Operation(summary = "根据房间id获取可选支付方式列表")
        @GetMapping("listByRoomId")
        public Result<List<PaymentType>> list(@RequestParam Long id) {
            List<PaymentType> list = service.listByRoomId(id);
            return Result.ok(list);
        }

    }
